<?php


namespace app\api\validate;

use think\Validate;

class UserValidate extends Validate
{
    protected $rule = [
        'user_name' =>'max:11|unique:user,account_type,2',
        'school_name' =>'unique:user,account_type,2',
        'school_address' =>'unique:user,account_type,2',
        'password' =>'unique:user,account_type,2',
        'mobile' =>'max:11|unique:user|mobile',
        'account_type' =>'require',
    ];

    protected $message = [
        'user_name.require'=>'用户名不能空',
        'school_name.require'=>'学校名称不能为空',
        'password.require'=>'密码不能为空',
        'account_type.require'=>'长度不能超过11',
        'mobile.max'=>'长度不能超过11',
        'mobile.unique'=>'用户已存在'
    ];

    protected $scene = [
        'register'=>['mobile']
    ];
}